@echo off
echo 正在收集系统信息，请稍候...
echo ====================== System Information ====================== > sword_result.txt
systeminfo >> sword_result.txt

echo. >> sword_result.txt
echo ====================== Internet IP Information ====================== >> sword_result.txt
curl myip.ipip.net >> sword_result.txt

echo. >> sword_result.txt
echo ====================== Firewall Status ====================== >> sword_result.txt
netsh advfirewall show allprofiles >> sword_result.txt

echo. >> sword_result.txt
echo ====================== Memory Usage ====================== >> sword_result.txt
wmic OS get FreePhysicalMemory,TotalVisibleMemorySize >> sword_result.txt

echo. >> sword_result.txt
echo ====================== CPU Usage ====================== >> sword_result.txt
typeperf "\Processor(_Total)\% Processor Time" -sc 1 >> sword_result.txt

echo. >> sword_result.txt
echo ====================== Hosts File ====================== >> sword_result.txt
type C:\Windows\System32\drivers\etc\hosts >> sword_result.txt

echo. >> sword_result.txt
echo ====================== Local User Information ====================== >> sword_result.txt
whoami >> sword_result.txt

echo. >> sword_result.txt
echo ====================== Process List by CPU Usage ====================== >> sword_result.txt
tasklist /FI "CPUTIME gt 00:00:00" /FO TABLE /NH >> sword_result.txt

echo. >> sword_result.txt
echo ====================== ARP Table ====================== >> sword_result.txt
arp -a >> sword_result.txt

echo. >> sword_result.txt
echo ====================== Network Routing Information ====================== >> sword_result.txt
route print >> sword_result.txt

echo. >> sword_result.txt
echo ====================== DNS Information ====================== >> sword_result.txt
ipconfig /all | findstr /C:"DNS Servers" >> sword_result.txt

echo. >> sword_result.txt
echo ====================== TCP Connections ====================== >> sword_result.txt
netstat -ano | findstr "TCP" >> sword_result.txt

echo. >> sword_result.txt
echo ====================== UDP Connections ====================== >> sword_result.txt
netstat -ano | findstr "UDP" >> sword_result.txt

echo. >> sword_result.txt
echo ====================== Firewall Rules ====================== >> sword_result.txt
netsh advfirewall firewall show rule name=all >> sword_result.txt

echo. >> sword_result.txt
echo ====================== Startup Items ====================== >> sword_result.txt
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run >> sword_result.txt
reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Run >> sword_result.txt

echo. >> sword_result.txt
echo ====================== Scheduled Tasks ====================== >> sword_result.txt
schtasks /query /fo LIST /v >> sword_result.txt

echo. >> sword_result.txt
echo ====================== System Services ====================== >> sword_result.txt
sc query >> sword_result.txt

echo. >> sword_result.txt
echo ====================== Installed Software ====================== >> sword_result.txt
reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall /s | findstr "DisplayName" >> sword_result.txt

echo. >> sword_result.txt
echo ====================== Shared Folders ====================== >> sword_result.txt
net share >> sword_result.txt

echo 信息收集完成，结果已保存到 sword_result.txt 文件中。